// 通用功能
//打开一个居中的窗口,返回值新打开的窗口对象
//调用是可以不传递name和hasMenu参数，hasMenu默认为0即没有菜单栏
function openWindow(path, width, height, name, hasMenu) {
	var left = (screen.availWidth - width) / 2;
	var top = (screen.availHeight - height) / 2;
	var parameters = "toolbar=no,width=" + width + ",height=" + height + ",left=" + left + ",top=" + top + ",resizable=no,scrollbars=yes";
	if (hasMenu == undefined) {
		hasMenu=0;
	}
	parameters = (hasMenu == 1) ? ("menubar=yes," + parameters) : ("menubar=no," + parameters);
	//alert(parameters);
	var newWin;
	if (name== undefined) {
		newWin = window.open(path, "name", parameters);
	} else {
		newWin = window.open(path, name, parameters);
	}
	
	return newWin;
}

function ThreeColsFramesetRight(framesetID,width,url){alert(framesetID)
	var oFrameset=window.parent.document.getElementById(framesetID);
	var values = oFrameset.cols.split(",");
	var oldHref = parent.frames[2].location.href;
	var oldUrl = oldHref.substr(oldHref.lastIndexOf('/')+1);
	//alert(oldUrl);
    var newUrl = url.substr(url.lastIndexOf('/')+1);
	if (oldUrl != newUrl){
		oFrameset.cols=values[0]+',*,0';
		var func="ThreeColsFramesetRightSwitch('"+framesetID+"','"+width+"','"+url+"');";
		setTimeout(func,200);
	}else{
		if(values[2]==0){
			oFrameset.cols=values[0]+',*,'+width;
		}else{
			oFrameset.cols=values[0]+',*,0';
		}
	}
}

function ThreeColsFramesetRightSwitch(framesetID,width,url){
	var oFrameset2=window.parent.document.getElementById(framesetID);
	var values2 = oFrameset2.cols.split(",");
	parent.frames[2].location = url;
	oFrameset2.cols=values2[0]+',*,'+width;
}

function ThreeColsFramesetLeft(framesetID,width) {
	var oFrameset=window.parent.document.getElementById(framesetID);
	var values=oFrameset.cols.split(",");
	if(values[0]==0){
		oFrameset.cols=width+',*,'+values[2];
	}else{
		oFrameset.cols='0,*,'+values[2];
	}
}
